import java.util.Scanner;

public class B {
	public static void main(String[] args) {
		var sc = new Scanner(System.in);
		int n = sc.nextInt();
		String[] s = new String[n * 2 + 10];
		
		for(int i = 1; i <= 2 * n; i ++ ) {
			s[i] = sc.next();
		}
		for(int i = 1; i <= n; i ++ ) {
			if(!s[i].equals(s[i + n])) {
				for(int j = 0; j < n; ++ j ) {
					if(s[i].charAt(j) != s[i + n].charAt(j)) {
						System.out.print(i + " " + (j + 1));
						return;
					}
				}
			}
		}
	}
}
